package com.luom.fsp.model.vo;

import cn.hutool.json.JSONUtil;
import com.luom.fsp.model.entity.AfterSalesService;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * 售后服务视图
 *
*/
@Data
public class AfterSalesServiceVO implements Serializable {

    /**
     * 售后服务id
     */
    private Long id;

    /**
     * 订单id
     */
    private Long orderId;

    /**
     * 用户id
     */
    private Long userId;

    /**
     * 用户名
     */
    private String userName;


    /**
     * 订单
     */
    private OrderVO order;

    /**
     * 服务类型（return:退货，exchange:换货）
     */
    private String serviceType;

    /**
     * 服务状态（pending:待处理，processing:处理中，completed:已完成，rejected:已拒绝）
     */
    private String serviceStatus;

    /**
     * 服务原因描述
     */
    private String serviceReason;

    /**
     * 原因图片
     */
    private String serviceImages;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 修改时间
     */
    private Date updateTime;

    /**
     * 封装类转对象
     *
     * @param afterSalesServiceVO
     * @return
     */
    public static AfterSalesService voToObj(AfterSalesServiceVO afterSalesServiceVO) {
        if (afterSalesServiceVO == null) {
            return null;
        }
        AfterSalesService afterSalesService = new AfterSalesService();
        BeanUtils.copyProperties(afterSalesServiceVO, afterSalesService);
        return afterSalesService;
    }

    /**
     * 对象转封装类
     *
     * @param afterSalesService
     * @return
     */
    public static AfterSalesServiceVO objToVo(AfterSalesService afterSalesService) {
        if (afterSalesService == null) {
            return null;
        }
        AfterSalesServiceVO afterSalesServiceVO = new AfterSalesServiceVO();
        BeanUtils.copyProperties(afterSalesService, afterSalesServiceVO);
        return afterSalesServiceVO;
    }
}
